import java.util.Vector;

//calls calcs for stealth detection
//calls calcs for sight distance
//calls calcs for paranoia/spook

//looks for food, predators
//does not run when eating unless paranoia flag set by predator attack
public class AreaProximityHandler {

 static int MAXSIZE = SimulationConstants.simsize - 1; //one less than map size
 static int X = -1;
 static int Y = -1;
 static loc LOC;
 static int R;
 static Vector<loc> AREALOCS;
 static Vector<loc> PROXIMITYLOCS;

 public static void getAnimalLocationStats(AnimalObject animal){
  X = animal.getLocation().x;
  Y = animal.getLocation().y;
  R = animal.getArea(); //radius of attention is 1/2 area
 }

 public static Vector<loc> getLocationAreas(AnimalObject animal, int dist) {
  //based on animaltype look for appropriate food at location
  //no paranoia check needed
  AREALOCS = new Vector<loc>();
  getAnimalLocationStats(animal);
  
  R = dist;
   
  for(int x=-R; x < R;x++)
  {
    for(int y=-R; y<=R;y++)
    {
      if((x*x)+(y*y)<=R*R)
      {
        if(x+X>=0&&x+X<512&&y+Y>=0&&y+Y<512)
          AREALOCS.add( new loc(x+X,y+Y) );
      }
    }
  }
  

  return AREALOCS;
 }

 /*
 public static Vector<loc> getLocationProximities(AnimalObject animal){
  //based on animaltype look for appropriate food in proximity
  //paranoia check on proximity, gets whats immediately around us 
  
  getAnimalLocationStats(animal);
  PROXIMITYLOCS = new Vector<loc>();

  R = 1; //our proximity is always 1 here
  
  int x = 0, y = 0;
  for(int theta = 0; theta < 359; theta += 15) {
   //for every 15 degrees
   //cause its simpler, and faster and allows animals to 
   //not find things occasionally
   x = (int)Math.round(R * Math.cos(theta));
   x += X;
   if(x < 0) x = 0;
   if(x > MAXSIZE) x = MAXSIZE;
   y = (int)Math.round(R * Math.sin(theta));
   y += Y;
   if(y < 0) y = 0;
   if(y > MAXSIZE) y = MAXSIZE;
   PROXIMITYLOCS.add( new loc(x,y) );
  }
  return PROXIMITYLOCS;
 }
*/
 
 /* do this elsewhere
 public static void getAreaStats(AnimalObject animal) {
  //based on animaltype look for appropriate food in area
  //paranoia check on area, fuzzy gets whats in the general area
 }*/

}
